package one.bugu.android.demon.ui.activity.wallet;

import android.annotation.SuppressLint;
import android.content.Intent;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.juefeng.android.framework.view.annotation.LKContentView;
import com.juefeng.android.framework.view.annotation.LKInjectView;

import one.bugu.android.demon.R;
import one.bugu.android.demon.common.MyBaseActivity;
import one.bugu.android.demon.constant.Constant;
import one.bugu.android.demon.ui.activity.ShortMessageActivity;
import one.bugu.android.demon.ui.activity.VoiceActivity;
import one.bugu.android.demon.ui.widget.BaseTopBarView;
import one.bugu.android.demon.util.OnViewClickListener;
import one.bugu.android.demon.util.PreferencesUtil;
import one.bugu.android.demon.util.StatusBarUtils;

/**
 * PackageName: one.bugu.android.demon.ui.activity.wallet
 * Content: 账户页面
 *
 * @author Administrator
 * @date 2018/12/13 9:48
 */
@LKContentView(R.layout.activity_account)
public class AccountActivity extends MyBaseActivity {
    /**
     * topbar
     */
    @LKInjectView(R.id.btbv_account)
    private BaseTopBarView btbv_account;
    /**
     * 短信layout
     */
    @LKInjectView(R.id.ll_account_msg)
    private LinearLayout ll_account_msg;
    /**
     * 短信数量
     */
    @LKInjectView(R.id.tv_account_msg)
    private TextView tv_account_msg;
    /**
     * 语音layout
     */
    @LKInjectView(R.id.ll_account_voice)
    private LinearLayout ll_account_voice;
    /**
     * 语音数量
     */
    @LKInjectView(R.id.tv_account_voice)
    private TextView tv_account_voice;

    @Override
    protected void initView() {
        super.initView();
        //设置状态栏
        StatusBarUtils.getInstance().setStatusBar("#FFFFFF", this, btbv_account, false);

    }

    @Override
    protected void initData() {
        super.initData();

    }

    @SuppressLint("SetTextI18n")
    @Override
    protected void onResume() {
        super.onResume();
        //获取数据
        String voiceNum = PreferencesUtil.getInstance().getString(this, Constant.VOICENUM, "0");
        String msgNum = PreferencesUtil.getInstance().getString(this, Constant.SHORTMESSAGENUM, "0");
        tv_account_msg.setText(msgNum + "条");
        tv_account_voice.setText(voiceNum + "条");
    }

    @Override
    protected void initEvent() {
        super.initEvent();
        btbv_account.setEventInterface(new BaseTopBarView.EventInterface() {
            @Override
            public void leftOnClick() {
                finish();
            }

            @Override
            public void leftCloseClick() {

            }

            @Override
            public void rightOnClick() {

            }
        });
        //短信跳转
        ll_account_msg.setOnClickListener(new OnViewClickListener() {
            @Override
            protected void singleClick(View view) {
                Intent intent = new Intent(AccountActivity.this, ShortMessageActivity.class);
                startActivity(intent);
            }
        });
        //语音跳转
        ll_account_voice.setOnClickListener(new OnViewClickListener() {
            @Override
            protected void singleClick(View view) {
                Intent intent = new Intent(AccountActivity.this, VoiceActivity.class);
                startActivity(intent);
            }
        });
    }

}
